# Maintainer: Alexander F. Rødseth <xyproto@archlinux.org>
# Contributor: Roman Kyrylych <roman@archlinux.org>
# Contributor: yosh64 <yosh64@gmail.com>

pkgname=mtpaint
pkgver=3.50.09
pkgrel=3
pkgdesc='Paint program for creating icons and pixel art'
arch=(loong64 x86_64)
url='https://github.com/wjaguar/mtpaint'
license=(GPL3)
depends=(gtk3 openjpeg2)
makedepends=(git)
optdepends=('gifsicle: export GIF files from mtPaint')
source=('https://raw.githubusercontent.com/puppylinux-woof-CE/woof-CE/e904dc79b479b3e62c69c65e744a8715fcfed0fa/woof-code/rootfs-petbuilds/mtpaint/wayland.patch'
  "git+$url#commit=199472ad6a4ecee6c8583fb5a504a2e99712b4fc") # version: 3.50.09, no git tags available
b2sums=('e11a93ba95887abbca866db6687c0a2d410dd657649a17a0c97776977fe6c7bf69dccbf746309d7fdec44a5123c0ee5a47f2c093486b353bfed4c11799d167c0'
        'SKIP')

prepare() {
  cd $pkgname
  patch -p1 -i ../wayland.patch
}

build() {
  cd $pkgname
  export CFLAGS="$(pkg-config openjp2 --cflags) -w $CFLAGS"
  ./configure --mandir=/usr/share/man --prefix=/usr \
    cflags gtk3 intl jp2v2 jpeg lcms2 man tiff
  make
}

package() {
  make -C $pkgname DESTDIR="$pkgdir" install
}
